import logging
from logging.handlers import TimedRotatingFileHandler
# 定义日志格式
formatter = logging.Formatter("%(asctime)s - %(module)s - %(funcName)s - line:%(lineno)d - %(levelname)s - %(message)s")

# 定义日志
imaotai_log = logging.Logger(name='i茅台预约日志', level=logging.INFO)

imaotai_file = TimedRotatingFileHandler(filename=f'./logs/imaotai.log',when="MIDNIGHT", interval=1, backupCount=7,encoding='utf-8')
#日志格式
imaotai_file.setFormatter(formatter)

#将日志输出至文件
imaotai_log.addHandler(imaotai_file)

